Experimental option to transcode surround sound audio to AC3#947
Conversation
|
Merged this to 0.5.1 release and tested on Yamaha ARC receiver + Sony Android TV. When playing AAC 5.1 it will convert it to AC3 5.1 and play beautifully on receiver as it should, but there are downsides as you mentioned. When this conversion occurs it indeed does seems to do something with video somewhere - i don't have explanation for this except black magic. From what I can see in Jellyfin server logs it just direct stream (copy) video , transcode audio to ac3 (-codec:a:0 ac -ac 6 -ab 640000) a send it. This is especially jarring when using/changing subtitles. Maybe problem on Wholphin side? Also I managed to break this fix entirely when transcoded video started playing, i changed audio to basic AC3 track in another language and activated subtitles there - then returned audio to original AAC track and activated subtitles ... AAC collapsed to PCM 2.0 and video no longer transcoded :D Kinda wondering if the changes in DeviceProfileUtils.kt would not be the culprit. |
What do you mean? Like the video is glitching?
Oh yeah. There's some special logic when switching tracks if direct play is occurring. It will bypass using the device profile to check with the server if the newly selected tracks are direct playable from ExoPlayer's perspective. Not sure if I explained that well enough, but I know where to fix this in the code. |
|
I'm very interested in this PR, since I have a S/PDIF connection with my receiver. And I currently can't use Wholphin because of this.
I either won't be able to use subtitles or videos will always be transcoded together with audio? |
If the audio is being transcoded, then if you enable an embedded subtitle track, it will switch the video to transcode as well in order to burn-in the subtitles. But, I still need to investigate a bit more because I believe this situation happens because the transcoded stream is |
|
I see. Thanks for explaining! |
Just annoying waiting time every time you change something because of the transcode issue. Sorry for confusion :) |
@n8llcaster The latest commit, 5d6b8ff, should fix this now. I'll eventually need to figure out a better, more generalized way to handle this type of "unsupported" track, but for now, this should work. |
|
First of all, thanks to the creators of WHOLPHIN for the best app I've tried for Jellyfin 👍 I tried everything to transcode OPUS 5.1 and AAC 5.1 on Smart TVs (Android TV, LG webOS, and Samsung Tizen) to use the SPDIF and HDMI ARC outputs. On Android, the only external players that worked were Kodi and Vimu Media Player. I installed the experimental WHOLPHIN version and enabled AC3 transcoding, but it didn't work on my Smart TV running Google TV 12. |
This change forces all multichannel audio to be transcoded to AC3 5.1. This is meant for TV's/devices that support SPDIF and/or ARC, but not eARC. Therefore they are limited to 6 channels and the AC3 codec (many such devices support DTS codec as well, but not as universally as AC3). However, they frequently advertise support for more channels and newer codecs, silently downmixing such audio streams internally. This change ensures that the client can still output multichannel audio that is compatible with the device. This change does not force video transcode, or alter existing video stream transcoding behavior. This change primarily: 1. Adds a toggle to enable this mode. 2. Manages potentially conflicting 'Downmix to Stereo' and 'AC3 Supported' toggles. 3. For video libraries, if toggle is enabled, sets max channels to 6 and invalidates all non-AC3 codecs for multichannel audio. 4. For music libraries, if toggle is enabled, sets max channels to 6 and requests transcode to AC3 in mka container for multichannel audio. Similar to Experimental PR damontecres#947. 1. UT's added to validate and prevent potential toggle conflicts. 2. Manually tested on Firestick 4k (1st gen) in video+audio libraries: - Stereo audio content plays with DirectPlay - Multichannel AC3 content plays with DirectPlay - Multichannel non-AC3 content plays with DirectStream N/A LLM's were used for planning, initial draft and critical review. All code changes were manually reviewed and vetted.
|
I tested the develop/ac3-test build v1.0.1-18-g57203117 on an Amazon Fire TV Stick and can confirm it fixes the multichannel AAC issue for my setup. Previously, AAC 5.1 audio was DirectPlayed, resulting in stereo/PCM output. With the develop/ac3-test build and "Use AC3 for surround sound audio" enabled:
The debug overlay confirms::
This is exactly the behaviour I was hoping for. Thank you for implementing this feature. I hope it can be merged into the main release, as I think it will benefit many Fire TV and Android TV users with ARC/eARC or SPDIF audio setups. One question, is this feature planned to be merged into the main develop branch, or should Fire TV users continue using the develop/ac3-test build for now? For anyone else testing the same issue for now, this is the v1.0.1-18-g57203117 build I used: https://github.com/damontecres/Wholphin/releases/tag/develop-ac3-test |
Includes changes for transcoding music & other audio formats beyond AAC/Opus Co-authored-by: darkflame91 <darkflame91@gmail.com>
|
I've moved this to be an experimental feature and incorporated some changes from #1410. I need to test a bit more, but I am planning to merge this into main! |
|
@damontecres thanks for incorporating my changes. I went into a rabbit hole looking into the PGS subtitle issue - I built a (wonky!) POC to support PGS subtitles sent by Jellyfin as external SUP files : darkflame91@f122561 However, I was also looking into device side transcoding, and I've raised PR's for it (damontecres/wholphin-extensions#10 and #1642) |
It's now in experimental settings |
## Description Fixes [compile error](https://github.com/damontecres/Wholphin/actions/runs/29357259594/job/87167912698) ### Related issues Resulted from merging #947 & #1680 together into main ### Testing Compiled & unit tests ## Screenshots N/A ## AI or LLM usage None
|
Tested experimental setting in v1.0.3-22-gcf3c00a1 and it works as it should! Good job! Only weird bug i noticed is that i managed to break SRT entirely when changing audios and it wasn't showing SRT subtitles at all in any medium I tried. PGS/SUB and other "picture" subtitle formats are working... but SRT is not working anymore anywhere, even after force kill of an app :D |

Description
Adds an experimental setting to prefer transcoding audio with more than 2 channels to AC3. Stereo audio does not transcode.
This is basically a workaround for HDMI ARC (not eARC) or optical audio devices because instead of 2 uncompressed PCM channels, 6 AC3 channels (ie 5.1) is possible.
An downside of enabling this is that embedded subtitles be burned in causing a video transcode as well.
Related issues
Fixes #255
Incorporates some code from #1410
Testing
Just on the emulator so far to observe if the settings trigger the transcode or not
Screenshots
N/A
AI or LLM usage
None